package com.marvels.common.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.context.ApplicationContext;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSONObject;
import com.marvels.approve.common.utils.ApplicationContextAchieve;
import com.marvels.common.constants.MarvelsConstant;
import com.marvels.common.dao.UserRechargeLogDao;
import com.marvels.common.dto.MarvelsResultDTO;
import com.marvels.common.dto.UserDTO;
import com.marvels.common.dto.UserRechargeLogDTO;
import com.marvels.common.utils.CacheUtils;
import com.marvels.common.utils.MarvelsLogUtil;
import com.yeepay.shade.org.apache.commons.lang3.StringUtils;

import cn.hutool.core.date.DateUtil;

public class MarvelsCommonInterceptor implements HandlerInterceptor {
	
	public final static  String requestName="system-down-request-time";
	
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws Exception {
		 // 需要被拦截的请求加上这个参数，以便判断并处理系统停用功能
        Long requestStartTime = System.currentTimeMillis();
        request.setAttribute(requestName,requestStartTime);
        return true;
	}
	
	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
			ModelAndView modelAndView) throws Exception {
		// TODO Auto-generated method stub
	}

	@Override
	public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
			throws Exception {
		// TODO Auto-generated method stub

	}

}
